//
//  ThemeComment.m
//  奇阅
//
//  Created by 奇阅科技 on 14-11-10.
//  Copyright (c) 2014年 奇阅科技. All rights reserved.
//

#import "ThemeComment.h"
#import "Config.h"
@implementation ThemeComment
+(NSString *)getTableName
{
    return @"ThemeComment";
}
+(ThemeComment *)getFromDict:(NSDictionary *)dict withBook:(Book *)book{
    ThemeComment *comment = [ThemeComment new];
    comment.uid = [dict objectForKey:@"uid"];
    comment.commentid = [dict objectForKey:@"id"];
    comment.book = book;
    comment.articleid = book.articleid;
    comment.time = [dict objectForKey:@"time"];
    comment.nickName = [dict objectForKey:@"aliases"];
    comment.headimg = [dict objectForKey:@"headimg"];
    comment.contents = [dict objectForKey:@"contents"];
    comment.point_like = [dict objectForKey:@"point_like"];
    comment.reply_num = [dict objectForKey:@"reply_num"];
    return comment;
}
+(ThemeComment *)getMyThemeCommentFromDict:(NSDictionary *)dict{
    ThemeComment *comment = [ThemeComment new];
    UserAccount *user = [UserAccount currentAccount];
    comment.headimg = user.headimg;
    comment.nickName = user.nickname;
    comment.uid = [dict objectForKey:@"uid"];
    comment.commentid = [dict objectForKey:@"id"];
    comment.book = [Book getFromDict:dict];
    comment.articleid = comment.book.articleid;
    comment.time = [dict objectForKey:@"time"];
    comment.contents = [dict objectForKey:@"contents"];
    comment.point_like = [dict objectForKey:@"point_like"];
    comment.reply_num = [dict objectForKey:@"reply_num"];
    return comment;
}
+(ThemeComment *)getThemeCommentFromDict:(NSDictionary *)dict{
    ThemeComment *comment = [ThemeComment new];
    comment.uid = [dict objectForKey:@"uid"];
    comment.commentid = [dict objectForKey:@"id"];
    comment.headimg = [dict objectForKey:@"headimg"];
    comment.nickName = [dict objectForKey:@"aliases"];
    comment.book = [Book getFromDict:dict];
    comment.articleid = comment.book.articleid;
    comment.time = [dict objectForKey:@"time"];
    comment.contents = [dict objectForKey:@"contents"];
    comment.point_like = [dict objectForKey:@"point_like"];
    comment.reply_num = [dict objectForKey:@"reply_num"];
    return comment;
}
//更新 数据
-(void)upDateNew:(ThemeComment *)newComment{
    self.point_like = newComment.point_like;
    self.reply_num = newComment.reply_num;
    self.headimg = newComment.headimg;
    self.nickName = newComment.nickName;
}

@end
